import Vue from "vue";
import VueRouter from "vue-router";
import Login from "../views/login/Login.vue";
import Register from "../views/login/Register.vue";
import Index from "../views/Index.vue";
import DeviceList from "../views/diviceList/deviceList.vue";
import UserList from "../views/userList/userList.vue";
import DeviceLog from "../views/log/deviceLog.vue";
import LedLog from "../views/log/ledLog.vue";
import TempHumidityLog from "../views/log/tempHumidityLog.vue";
import InfraredLog from "../views/log/infraredLog.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/login",
    component: Login,
  },
  {
    path: "/register",
    component: Register,
  },
  {
    path: "/index",
    component: Index,
    children: [
      {
        path: "/deviceList",
        component: DeviceList,
      },
      {
        path: "/userList",
        component: UserList,
      },
      {
        path: "/deviceLog",
        component: DeviceLog,
      },
      {
        path: "/ledLog",
        component: LedLog,
      },
      {
        path: "/tempHumidityLog",
        component: TempHumidityLog,
      },
      {
        path: "/infraredLog",
        component: InfraredLog,
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
